﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// ECS组
/// </summary>
public class ECSGroup
{
    private int m_key;
    /// <summary>
    /// 该ecs组包含的组件的key值
    /// </summary>
    public int Key
    {
        get { return m_key; }
        set { m_key = value; }
    }
    /// <summary>
    /// 该ecs组存储哪些组件
    /// </summary>
    public string[] compoents;
    /// <summary>
    /// 该ecs组存储组件的哈希(每个组件应位于实体组件数组中哪个下标)
    /// </summary>
    public int[] compoentHashs;

    public ECSGroup(int key, string[] compoentsName, ECSWorldBase world)
    {
        this.Key = key;
        this.compoents = compoentsName;
        for (int i = 0,j= compoents.Length; i <j; i++)
        {
            compoentHashs[i] = world.compoentType.GetCompoentIndex(compoentsName[i]);
        }
    }

}

